/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 * PARTICULAR PURPOSE.
 * ***************************************************************************/


#include "stdafx.h"
#include <pgl/core/PGL.h>
#include <pgl/core/PGLMapVectorPropPage.h>
#include <pgl/core/PGLRegion.h>

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPGLMapVectorPropPage property page

IMPLEMENT_DYNCREATE(CPGLMapVectorPropPage, CPropertyPage)

CPGLMapVectorPropPage::CPGLMapVectorPropPage(CPGLMapVectorStPtr pMapVector) : CPropertyPage(CPGLMapVectorPropPage::IDD)
{
	//{{AFX_DATA_INIT(CPGLMapVectorPropPage)
	m_dLineWidth = 0.0;
	//}}AFX_DATA_INIT
	m_pMapVector = pMapVector;
}

CPGLMapVectorPropPage::~CPGLMapVectorPropPage()
{
}

void CPGLMapVectorPropPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPGLMapVectorPropPage)
	DDX_Text(pDX, IDC_PGL_EDIT_LINEWIDTH, m_dLineWidth);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPGLMapVectorPropPage, CPropertyPage)
	//{{AFX_MSG_MAP(CPGLMapVectorPropPage)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPGLMapVectorPropPage message handlers

BOOL CPGLMapVectorPropPage::OnSetActive() 
{
	PGL_ASSERT_VALID(m_pMapVector);
	
	m_dLineWidth = m_pMapVector->GetLineWidth();

	UpdateData(FALSE);

	return CPropertyPage::OnSetActive();
}

BOOL CPGLMapVectorPropPage::OnKillActive() 
{
	PGL_ASSERT_VALID(m_pMapVector);

	UpdateData(TRUE);
	
	m_pMapVector->SetLineWidth((float)m_dLineWidth);

	return CPropertyPage::OnKillActive();
}
